#include<iostream>
#include<functional>
#include<set>

#include"Server.hpp"
#include"Chat.hpp"

int main(int argc,char* argv[])
{
    if(2!=argc)
    {
        printf("Error usage:%s\nUsage: %s port\n",argv[0],argv[0]);
        exit(-1);
    }
    int port=htons(std::stoi(argv[1]));
    Chat chat;
    Server server(port,std::bind(&Chat::Broadcast,&chat,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3));
    server.Start();
    return 0;
}